﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using xstore.service;

namespace xstore.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ObjectController : ControllerBase
    {
        private readonly S3ClientToCtyun s3Client = S3ClientToCtyun.GetInstance();


        private const string BUCKET = "";

        private const string KEY = "object/key";

        private const string FILE_PATH = "D:\\You\\local\\file\\path";

        [HttpPost("upload/default")]
        public string UploadFileToBucket()
        {
            try
            {
                s3Client.MultipartUpload(BUCKET, KEY, FILE_PATH);
                return "success";
            }
            catch (Exception e)
            {
                return "error! " + e.Message;
            }

        }
    }
}
